{extend name="layout:base" /}
{block name="page_content"}
  <div class="row">
    <div class="tabbable">
      <ul class="nav nav-tabs" id="myTab">
        <li class="active">
          <a data-toggle="tab" href="#basic">
            基本设置
          </a>
        </li>
        <li>
          <a data-toggle="tab" href="#contact">
            联系方式
          </a>
        </li>
        <li class="dropdown">
          <a data-toggle="tab" href="#seo">
            SEO设置
          </a>
        </li>
      </ul>
      <form id="settings-form" class="form-horizontal" method="post" action="{:url('site')}">
        <fieldset>
          <div class="tab-content">
            <div id="basic" class="tab-pane fade in active">
              <div class="form-group">
                <label class="col-sm-3 control-label no-padding-right" for="form-field-1">
                  站点名称
                </label>
                <div class="col-sm-9">
                  <input type="text" name="options[site_name]" id="site_name" value="{$options.site_name|default=''}" class="col-xs-10 col-sm-5" placeholder="网站名称" required/>
                  <span class="help-inline col-xs-12 col-sm-7">
                    <span class="middle" id="resone">*</span>
                  </span>
                </div>
              </div>
              <div class="space-4"></div>

              <div class="form-group">
                <label class="col-sm-3 control-label no-padding-right" for="form-field-1">
                  站点网址
                </label>
                <div class="col-sm-9">
                  <input type="text" name="options[site_host]" id="site_host" value="{$options.site_host|default=''}"  class="col-xs-10 col-sm-5" placeholder="网站域名，例:http://localhost" required/>
                  <span class="help-inline col-xs-12 col-sm-7">
                    <span class="middle" id="restwo">*</span>
                  </span>
                </div>
              </div>
              <div class="space-4"></div>


              <div class="form-group">
                <label class="col-sm-3 control-label no-padding-right" for="form-field-1">
                  备案信息
                </label>
                <div class="col-sm-9">
                  <input type="text" name="options[site_icp]" id="site_icp" value="{$options.site_icp|default=''}" placeholder="网站备案号，例：京ICP备15049788号-7" class="col-xs-10 col-sm-5" />
                </div>
              </div>
              <div class="space-4"></div>

              <div class="form-group">
                <label class="col-sm-3 control-label no-padding-right" for="form-field-1">
                  统计代码
                </label>
                <div class="col-sm-9">
                  <textarea  name="options[site_tongji]" cols="20" rows="2" class="col-xs-10 col-sm-7 limited"   id="form-field-9" placeholder="百度、google等统计平台的统计JS代码">{$options.site_tongji|default=''}</textarea>
                </div>
              </div>
              <div class="space-4"></div>

              <div class="form-group">
                <label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 版权信息 </label>
                <div class="col-sm-9">
                  <textarea  name="options[site_copyright]" cols="20" rows="3" class="col-xs-10 col-sm-7 limited1"   id="form-field-10"  placeholder="例: Power By <a href='https://www.simpleedu.com.cn/'>Simple</a>">{$options.site_copyright|default=''}</textarea>
                </div>
              </div>
              <div class="space-4"></div>
            </div>

            <div id="contact" class="tab-pane fade">
              <div class="form-group">
                <label class="col-sm-3 control-label no-padding-right" for="form-field-1">
                  公司名称
                </label>
                <div class="col-sm-9">
                  <input type="text" name="options[site_co_name]" id="site_co_name" value="{$options.site_co_name|default=''}" placeholder="公司名称" class="col-xs-10 col-sm-5" />
                </div>
              </div>
              <div class="space-4"></div>

              <div class="form-group">
                <label class="col-sm-3 control-label no-padding-right" for="form-field-1">
                  公司地址
                </label>
                <div class="col-sm-9">
                  <input type="text" name="options[site_address]" id="site_address" value="{$options.site_address|default=''}" placeholder="公司地址" class="col-xs-10 col-sm-5" />
                </div>
              </div>
              <div class="space-4"></div>

              <div class="form-group">
                <label class="col-sm-3 control-label no-padding-right" for="form-field-1">
                  联系电话
                </label>
                <div class="col-sm-9">
                  <input type="text" name="options[site_tel]" id="site_tel" value="{$options.site_tel|default=''}" placeholder="18302902891" class="col-xs-10 col-sm-5" />
                </div>
              </div>
              <div class="space-4"></div>

              <div class="form-group">
                <label class="col-sm-3 control-label no-padding-right" for="form-field-1">
                  站长邮箱
                </label>
                <div class="col-sm-9">
                  <input type="email" name="options[site_admin_email]" id="site_admin_email" value="{$options.site_admin_email|default=''}"  placeholder="zhanghong_bean@126.com" class="col-xs-10 col-sm-5" />
                </div>
              </div>
              <div class="space-4"></div>

              <div class="form-group">
                <label class="col-sm-3 control-label no-padding-right" for="form-field-1">
                  站长QQ
                </label>
                <div class="col-sm-9">
                  <input type="number" name="options[site_qq]" id="site_qq" value="{$options.site_qq|default=''}"  class="col-xs-10 col-sm-5" placeholder="305839090" />
                </div>
              </div>
              <div class="space-4"></div>
            </div>

            <div id="seo" class="tab-pane fade">
              <div class="form-group">
                <label class="col-sm-3 control-label no-padding-right" for="form-field-1">
                  默认SEO标题
                </label>
                <div class="col-sm-9">
                  <input type="text" name="options[site_seo_title]" id="site_seo_title" value="{$options.site_seo_title|default=''}"  class="col-xs-10 col-sm-5" placeholder="SEO默认标题" />
                </div>
              </div>
              <div class="space-4"></div>

              <div class="form-group">
                <label class="col-sm-3 control-label no-padding-right" for="form-field-1">
                  默认SEO关键字
                </label>
                <div class="col-sm-9">
                  <textarea  name="options[site_seo_keywords]" cols="20" class="col-xs-10 col-sm-7 limited2"  id="form-field-11" placeholder="SEO默认关键字">{$options.site_seo_keywords|default=''}</textarea>
                </div>
              </div>
              <div class="space-4"></div>

              <div class="form-group">
                <label class="col-sm-3 control-label no-padding-right" for="form-field-1">
                  默认SEO描述
                </label>
                <div class="col-sm-9">
                  <textarea name="options[site_seo_description]" cols="20" rows="4" class="col-xs-10 col-sm-7 limited3" id="form-field-12" placeholder="SEO默认描述">{$options.site_seo_description|default=''}</textarea>
                </div>
              </div>
              <div class="space-4"></div>
            </div>
          </div>
          <div class="clearfix form-actions">
            <div class="col-sm-offset-3 col-sm-9">
              <button class="btn btn-info" type="submit">
                <i class="ace-icon fa fa-check bigger-110"></i>
                保存
              </button>

              &nbsp; &nbsp; &nbsp;
              <button class="btn" type="reset">
                <i class="ace-icon fa fa-undo bigger-110"></i>
                重置
              </button>
            </div>
          </div>
        </fieldset>
      </form>
    </div>
  </div>
{/block}
{block name="page_js"}
  <script src="{$site_root}/static/plugins/jquery-validate/jquery.validate.min.js"></script>
  <script type="text/javascript">
    $(document).ready(function(){
      $("form#settings-form").validate({
        rules:{
          "options[site_name]":{
            required: true
          }, "options[site_host]":{
            required: true,
            url: true
          }, "options[site_tel]":{
            required: true,
            minlength: 10,
            maxlength: 15
          }, "options[site_admin_email]":{
            required: true,
            email: true,
            maxlength: 50
          }
        },
        messages:{
          "options[site_name]":{
            required: "站点名称不能为空",
            minlength: "站点名称不能少于3个字符",
            maxlength: "站点名称不能超过60个字符"
          }, "options[site_host]":{
            required: "站点网址不能为空",
            url: "站点网址格式不正确"
          }, "options[site_tel]":{
            required: "联系电话不能为空",
            minlength: "联系电话格式不正确",
            maxlength: "联系电话格式不正确"
          }, "options[site_admin_email]":{
            required: "站长邮箱不能为空",
            email: "站长邮箱格式不正确",
            maxlength: "站长邮箱格式不正确"
          }
        },
        errorClass: "help-inline input-error",
        errorElement: "span",
        highlight:function(element, errorClass, validClass) {
          $(element).parents('.form-group').addClass('has-error');
        },
        unhighlight: function(element, errorClass, validClass) {
          $(element).parents('.form-group').removeClass('has-error');
          // $(element).parents('.form-group').addClass('success');
        }
      });
    });
  </script>
{/block}